package ebj.common.digest;

import org.apache.commons.codec.digest.DigestUtils;

public class MD5Test {
	// 加密后的文字串
	static final String CHANGEME_MD5_STR = "4cb9c8a8048fd02294477fcb1a41191a";
	// 被加密的文字串
	static final String TARGET = "changeme";

	public static void main(String[] args) {
		String string = "sddfasdf";
		String md5String = DigestUtils.md5Hex(string);
		System.out.println(md5String);
		System.out.println(md5String.toUpperCase());

		System.out.println("common codec result: "+ DigestUtils.md5Hex(TARGET));
		if (CHANGEME_MD5_STR.equals(DigestUtils.md5Hex(TARGET))) {
			System.out.println("code result same with mysql request too. length is ["
					+ DigestUtils.md5Hex(TARGET).length() + "]");
		}
	}
}
